package com.example.chat.utils;

import com.alibaba.fastjson2.JSON;
import com.example.chat.vo.ResultMessage;

/**
 * 封装json格式的消息工具类
 *
 * @author Lay.He
 * @date 2023/11/23 21:03
 */
public class MessageUtils {

    public static String getMessage(boolean isSystemMessage, String fromName, Object message) {
        ResultMessage build = ResultMessage.builder()
            .systemMessage(isSystemMessage)
            .message(message)
            .fromName(fromName)
            .build();
        return JSON.toJSONString(build);
    }
}
